
--Thanks for the time BadKing.
 function util.SimpleTime(seconds, fmt)
if not seconds then seconds = 0 end

    ms = (seconds - math.floor(seconds)) * 100
    seconds = math.floor(seconds)
    s = seconds % 60
    seconds = (seconds - s) / 60
    m = seconds % 60

    return string.format(fmt, m, s, ms)
end


function HLhud()

ply = LocalPlayer()

hpcross = surface.GetTextureID ("halflife/hp_cross")
armor = surface.GetTextureID ("halflife/armor")
clock = surface.GetTextureID ("halflife/clock")
flash_on = surface.GetTextureID ("halflife/flash-on")
flash_off = surface.GetTextureID ("halflife/flash-off")

hudPosX = ScrW() * .0089
hudPosY = ScrH() - ScrH() * .046

TimeSeconds = GetGlobalVar( "hns_time_left" ) or ""
TimeLeft = util.SimpleTime(TimeSeconds,"%02i:%02i")


	--Health
	if ply:Health() <= 25 then
		surface.SetTexture( hpcross )
		surface.SetDrawColor( 255, 0, 0, 255 )
		surface.DrawTexturedRect (hudPosX,hudPosY,30,30)
		draw.SimpleText(ply:Health(), "digital", hudPosX +94, hudPosY +15, Color(255, 0, 0, 200), 2, 1)
	else
		surface.SetTexture( hpcross )
		surface.SetDrawColor( 255, 220, 0, 255 )
		surface.DrawTexturedRect (hudPosX,hudPosY,30,30)
		draw.SimpleText(ply:Health(), "digital", hudPosX +94, hudPosY +15, Color(255, 220, 0, 255), 2, 1)
	end
	
	--Armor
	if ply:Armor() <=25 then
		surface.SetTexture( armor )
		surface.SetDrawColor( 255, 0, 0, 255 )
		surface.DrawTexturedRect (ScrW() * .25 -70,hudPosY,30,30)
		draw.SimpleText(ply:Armor(), "digital", ScrW() * .25 +23, hudPosY +15, Color(255, 0, 0, 255), 2, 1)
	else
		surface.SetTexture( armor )
		surface.SetDrawColor( 255, 200, 0, 255 )
		surface.DrawTexturedRect (ScrW() * .25 -70,hudPosY,30,30)
		draw.SimpleText(ply:Armor(), "digital", ScrW() * .25 +23, hudPosY +15, Color(255, 200, 0, 255), 2, 1)
	end
	
	
	--Time
		surface.SetTexture( clock )
		surface.SetDrawColor( 255, 200, 0, 255 )
		surface.DrawTexturedRect (ScrW()/2-85,hudPosY,30,30)
		draw.SimpleText(TimeLeft, "digital", ScrW()/2 - 50, hudPosY -6, Color(255, 200, 0, 255), TEXT_ALIGN_LEFT)
		

	--FlashLight
	if ( !ply:FlashlightIsOn() ) then
		surface.SetTexture( flash_off )
		surface.SetDrawColor( 255, 200, 0, 255 )
		surface.DrawTexturedRect (ScrW()-ScrW() *.027,ScrH()*.033,52,38)
	else 
		surface.SetTexture( flash_on )
		surface.SetDrawColor( 255, 200, 0, 255 )
		surface.DrawTexturedRect (ScrW()-ScrW() *.027,ScrH()*.033,52,38)
		surface.DrawTexturedRect (ScrW()-ScrW() *.027,ScrH()*.033,52,38)
	end

end
hook.Add("HUDPaint", "HLhud", HLhud)



    local currentGap = 0
	local currentLength
function CrossHair()

	ply = LocalPlayer()
	local animationStep = 0.5
	local endGap = 9
	local x = ScrW() / 2
	local y = ScrH() / 2
 
 	if ply:Alive() then
	
		if( ply:KeyDown( IN_FORWARD ) ) or
          ( ply:KeyDown( IN_BACK ) ) or
          ( ply:KeyDown( IN_MOVELEFT ) ) or
          ( ply:KeyDown( IN_MOVERIGHT ) ) or
          ( ply:KeyDown( IN_JUMP ) ) or
          ( ply:KeyDown( IN_ATTACK ) ) or
          ( !ply:OnGround() ) then
              endGap = 16
        elseif
           ( ply:KeyDown( IN_DUCK ) ) then
              endGap = 5
        end
       
        -- Animation
	if currentGap < endGap then
			currentGap = currentGap + animationStep
        elseif currentGap > endGap then
			currentGap = currentGap - animationStep
	end
       
		currentLength = currentGap + 12
       
        surface.SetDrawColor( 0, 255, 0, 255 )
        surface.DrawLine( x-2 - currentLength, y-1, x-2 - currentGap, y-1 )
        surface.DrawLine( x-2 - currentLength, y-2, x-2 - currentGap, y-2 )
        surface.DrawLine( x-2 + currentLength, y-1, x-2 + currentGap, y-1 )
        surface.DrawLine( x-2 + currentLength, y-2, x-2 + currentGap, y-2 )
        surface.DrawLine( x-1, y-1 - currentLength, x-1, y-1 - currentGap )
        surface.DrawLine( x-2, y-1 - currentLength, x-2, y-1 - currentGap )
        surface.DrawLine( x-1, y-1 + currentLength, x-1, y-1 + currentGap )
        surface.DrawLine( x-2, y-1 + currentLength, x-2, y-1 + currentGap )
		
	elseif !ply:Alive() then
	
		local gap2 = 12
		local length2 = gap2 +1
 
	surface.SetDrawColor( 255, 220, 0, 255 )
	surface.DrawLine( x - length2, y, x - gap2, y )
	surface.DrawLine( x, y, x, y )
	surface.DrawLine( x + length2, y, x + gap2, y )
	surface.DrawLine( x, y - length2, x, y - gap2 )
	surface.DrawLine( x, y + length2, x, y + gap2 )
	end
end
hook.Add("HUDPaint", "DrawsCrossHair", CrossHair)